
package biblio.domain;


import biblio.util.AuxClass;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;


/**
 *
 * @author mephisto
 */
@Entity
@Table(name="hire")
public class Hire implements Serializable
{
    @Id
    @GeneratedValue
    @Column(name="hire_id")
    public int getId()
    {
        return id;
    }

    public void setId(int id) 
    {
        this.id = id;
    }

    @ManyToOne(cascade = CascadeType.MERGE)
    @JoinColumn(name="reader_id")
    public Reader getReader()
    {
        return reader;
    }

    public void setReader(Reader reader)
    {
        this.reader = reader;
    }

    @ManyToOne(cascade = CascadeType.MERGE)
    @JoinColumn(name="book_id")
    public Book getBook()
    {
        return book;
    }

    public void setBook(Book book)
    {
        this.book = book;
    }

    @Temporal(javax.persistence.TemporalType.DATE)
    @Column(name="hire_date")
    public Date getHireDate()
    {
        return hireDate;
    }

    public void setHireDate(Date hireDate)
    {
        this.hireDate = hireDate;
    }

    @Temporal(javax.persistence.TemporalType.DATE)
    @Column(name="return_date")
    public Date getReturnDate()
    {
        return returnDate;
    }

    public void setReturnDate(Date returnDate)
    {
        this.returnDate = returnDate;
    }

    @Override
    public String toString()
    {
        return AuxClass.toString(this, 700);
    }


    private int id;
    private Date hireDate;
    private Date returnDate;
    private Reader reader;
    private Book book;
}
